<!DOCTYPE html>
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>注册</title>

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link rel="stylesheet" href="__PUBLIC__/regionfiles/bootstrap.min.css">
<link rel="stylesheet" href="__PUBLIC__/regionfiles/camera.css">
<link rel="stylesheet" href="__PUBLIC__/regionfiles/bootstrap-responsive.min.css">
<link rel="stylesheet" href="__PUBLIC__/regionfiles/matrix-login.css">
<link rel="stylesheet" href="__PUBLIC__/regionfiles/font-awesome.css">
<script type="text/javascript" src="__PUBLIC__/regionfiles/jquery-1.5.1.min.js"></script>
<!-- 软键盘控件start -->
<link href="__PUBLIC__/regionfiles/form.css" rel="stylesheet" type="text/css">
	<script src="__PUBLIC__/regionfiles/bootstrap.min.js"></script>
	<script src="__PUBLIC__/regionfiles/jquery-1.7.2.js"></script>
	<script src="__PUBLIC__/regionfiles/jquery.easing.1.3.js"></script>
	<script src="__PUBLIC__/regionfiles/jquery.mobile.customized.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/regionfiles/jquery.tips.js"></script>
	<script type="text/javascript" src="__PUBLIC__/regionfiles/jquery.cookie.js"></script>
</head>
<body  style="width:100px; height:100px; background:url(__PUBLIC__/regionfiles/banner_slide_01.jpg);">

	<!--小键盘承载器-->

	<div style="width:100%;text-align: center;margin: 0 auto;position: absolute;">

		<!-- 注册 -->
		<div id="windows2" style="">
		<div id="loginbox">
			<form action="admin/register?login=2&type=office" method="post" name="loginForm" id="loginForm">
				<div class="control-group normal_text">
					<h3>
						企业用户注册
					</h3>
				</div>
				<div class="control-group">
					<div class="controls">
						<div class="main_input_box">
							<span class="add-on bg_lg">
							<i>用户</i>
							</span><input type="text" name="USERNAME" id="USERNAME" value="" placeholder="请输入用户名" truetype="textinput" class="textinput">
						</div>
					</div>
				</div>
				<div class="control-group">
					<div class="controls">
						<div class="main_input_box">
							<span class="add-on bg_ly">
							<i>密码</i>
							</span><input type="password" name="PASSWORD" id="PASSWORD" placeholder="请输入密码" class="keypad hasKeypad textinput" keypadmode="full" allowkeyboard="true" value="" truetype="keypad">
						</div>
					</div>
				</div>
				<div class="control-group">
					<div class="controls">
						<div class="main_input_box">
							<span class="add-on bg_ly">
							<i>重输</i>
							</span><input type="password" name="chkpwd" id="chkpwd" placeholder="请重新输入密码" class="keypad hasKeypad textinput" keypadmode="full" allowkeyboard="true" value="" truetype="keypad">
						</div>
					</div>
				</div>
				<div class="control-group">
					<div class="controls">
						<div class="main_input_box">
							<span class="add-on bg_lg">
							<i>姓名</i>
							</span><input type="text" name="NAME" id="name" value="" placeholder="请输入姓名" truetype="textinput" class="textinput_hover">
						</div>
					</div>
				</div>
				<div class="control-group">
					<div class="controls">
						<div class="main_input_box">
							<span class="add-on bg_lg">
							<i>邮箱</i>
							</span><input type="text" name="EMAIL" id="EMAIL" value="" placeholder="请输入邮箱" truetype="textinput" class="textinput">
						</div>
					</div>
				</div>
				<div class="form-actions">
					<div style="width:86%;padding-left:8%;">

						<span class="pull-right" style="padding-right:3%;"><a href="__APP__/index?login=1" class="btn btn-success">取消</a></span>
						<span class="pull-right"><a onclick="register();" class="flip-link btn btn-info" id="to-recover">提交</a></span>
					</div>
				</div>
			</form>

		</div>
		</div>
		
	</div>


	<script type="text/javascript">
	//注册
	function rcheck(){
		if($("#USERNAME").val()==""){
			$("#USERNAME").tips({
				side:3,
	            msg:'输入用户名',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#USERNAME").focus();
			$("#USERNAME").val('');
			return false;
		}else{
			$("#USERNAME").val(jQuery.trim($('#USERNAME').val()));
		}
		if($("#PASSWORD").val()==""){
			$("#PASSWORD").tips({
				side:3,
	            msg:'输入密码',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#PASSWORD").focus();
			return false;
		}
		if($("#PASSWORD").val()!=$("#chkpwd").val()){
			$("#chkpwd").tips({
				side:3,
	            msg:'两次密码不相同',
	            bg:'#AE81FF',
	            time:3
	        });
			$("#chkpwd").focus();
			return false;
		}
		if($("#name").val()==""){
			$("#name").tips({
				side:3,
	            msg:'输入姓名',
	            bg:'#AE81FF',
	            time:3
	        });
			$("#name").focus();
			return false;
		}
		if($("#EMAIL").val()==""){
			$("#EMAIL").tips({
				side:3,
	            msg:'输入邮箱',
	            bg:'#AE81FF',
	            time:3
	        });
			$("#EMAIL").focus();
			return false;
		}else if(!ismail($("#EMAIL").val())){
			$("#EMAIL").tips({
				side:3,
	            msg:'邮箱格式不正确',
	            bg:'#AE81FF',
	            time:3
	        });
			$("#EMAIL").focus();
			return false;
		}

		return true;
	}
	
	//提交注册
	function register(){
		if(rcheck()){
		    console.log('111');
            $.post("__APP__/admin/register",{
                USERNAME:$("#USERNAME").val(),
                PASSWORD:$("#PASSWORD").val(),
                NAME:$("#name").val(),
                EMAIL:$("#EMAIL").val(),
                type:"office"
            }, function(data) {
                var str=data.msg;
                if(str==2){
                    alert("注册成功,请登录");
                    window.location.href='__APP__/index?login=1';
				}else {
                    alert("此用户名已注册，请更换用户名");
				}
            },"json");
		}
	}
	
	//邮箱格式校验
	function ismail(mail){
		return(new RegExp(/^(?:[a-zA-Z0-9]+[_\-\+\.]?)*[a-zA-Z0-9]+@(?:([a-zA-Z0-9]+[_\-]?)*[a-zA-Z0-9]+\.)+([a-zA-Z]{2,})+$/).test(mail));
	}
	//js  日期格式
	</script>

